<%@page import="com.test.bean.Player"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="JS/jquery-2.2.3.min.js">
</script>
<script type="text/javascript">
$(function(){
	$(".delete").click(function(){
		var content = $(this).parent().parent().find("td:eq(1)").text();
		var flag = confirm("确定要删除"+content+"吗?");
		return flag;
	});
});
</script>
<title>运动员信息展示主页</title>
</head>
<body>
<form action="query.do" method="post">
   <table>
      <tr>
         <td>姓名:</td>
         <td><input type="text" name="name"/></td>
      </tr>
       <tr>
         <td>球队:</td>
         <td><input type="text" name="team"/></td>
      </tr>
       <tr>
         <td>城市:</td>
         <td><input type="text" name="city"/></td>
      </tr>
       <tr>
         <td><input type="submit" value="提交"/></td>
         <td><a href="addPlayer.jsp">添加运动员</td>
      </tr>
      
   
   </table>

</form>
<br><br>
<%
	List<Player> players = (List<Player>)request.getAttribute("players");
    if (players != null && players.size() > 0) {
%>
<hr>
<br><br>
<table>
   <tr>
     <th>ID</th>
     <th>姓名</th>
     <th>球队</th>
     <th>城市</th>
     <th>删除</th>
     <th>编辑</th>
   </tr>
   <%
   	for(Player player:players){
   %>
     <tr>
     <td><%=player.getID() %></td>
     <td><%=player.getName() %></td>
     <td><%=player.getTeam() %></td>
     <td><%=player.getCity() %></td>
     <td><a href="delete.do?id=<%=player.getID() %>" class="delete">删除</a></td>
     <td><a href="edit.do?id=<%=player.getID() %>">编辑</a></td>
   </tr>
   <%		
   	}
   %>

</table>
<%
	}
%>
</body>
</html>